home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / net / cslip.lha / usr / amiga / src / cmd / slattach / slattach.c-diff
Text File  |  1992-11-11  |  2KB  |  93 lines

  1. *** /usr/amiga/src/cmd/slattach/slattach.c.orig    Wed Nov 11 17:55:00 1992
  2. --- /usr/amiga/src/cmd/slattach/slattach.c    Wed Nov 11 17:55:12 1992
  3. ***************
  4. *** 27,33 ****
  5. --- 27,39 ----
  6.   #define SLIP_WHICH_INTERFACE 'slwh'
  7.   #endif
  8.   
  9. + #define SLIP_GET_CONF_FLAGS  'slgc'
  10. + #define SLIP_SET_CONF_FLAGS  'slsc'
  11.   
  12. + #define    SC_COMPRESS    0x0002        /* compress TCP traffic */
  13. + #define    SC_NOICMP    0x0004        /* supress ICMP traffic */
  14. + #define    SC_AUTOCOMP    0x0008        /* auto-enable TCP compression */
  15.   static void catch(int sig)
  16.   {
  17.   }
  18. ***************
  19. *** 63,72 ****
  20.       int n;
  21.       char buf[512];
  22.       struct termios termios;
  23.   
  24.       if (argc < 3)
  25.       {
  26. !     fprintf(stderr, "Usage: %s speed local-address remote-address [ifconfig args]\n", argv[0]);
  27.       return -1;
  28.       }
  29.   
  30. --- 69,79 ----
  31.       int n;
  32.       char buf[512];
  33.       struct termios termios;
  34. +     int slip_flags, i;
  35.   
  36.       if (argc < 3)
  37.       {
  38. !     fprintf(stderr, "Usage: %s speed local-address remote-address [autocomp][compress][noicmp] [ifconfig args]\n", argv[0]);
  39.       return -1;
  40.       }
  41.   
  42. ***************
  43. *** 96,106 ****
  44.       return 1;
  45.       }
  46.   
  47.       {
  48. -     int i;
  49.       char *p = buf;
  50.       p += sprintf(p, "ifconfig sl%d", n);
  51.       for ( i=2 ; i<argc ; ++i )
  52.           p += sprintf(p, " %s", argv[i]);
  53.       p += sprintf(p, " up");
  54.       }
  55. --- 103,138 ----
  56.       return 1;
  57.       }
  58.   
  59. +     for (i = 2, slip_flags = 0; i < argc; i++)
  60. +       if (! strcmp (argv[i], "autocomp"))
  61. +     {
  62. +       slip_flags |= SC_AUTOCOMP;
  63. +       argv[i] = 0;
  64. +     }
  65. +       else if (! strcmp (argv[i], "compress"))
  66. +     {
  67. +       slip_flags |= SC_COMPRESS;
  68. +       argv[i] = 0;
  69. +     }
  70. +       else if (! strcmp (argv[i], "noicmp"))
  71. +     {
  72. +       slip_flags |= SC_NOICMP;
  73. +       argv[i] = 0;
  74. +     }
  75. +     if (ioctl (0, SLIP_SET_CONF_FLAGS, slip_flags) < 0)
  76. +       {
  77. +     fprintf (stderr, "%s: SLIP_SET_CONF_FLAGS FAILED: %s\n",
  78. +          argv[0], strerror (errno));
  79. +     return 1;
  80. +       }
  81.       {
  82.       char *p = buf;
  83.       p += sprintf(p, "ifconfig sl%d", n);
  84.       for ( i=2 ; i<argc ; ++i )
  85. +       if (argv[i])
  86.           p += sprintf(p, " %s", argv[i]);
  87.       p += sprintf(p, " up");
  88.       }
  89.